
import requestTreeData from '../../request-functions/getLeftTreeData';

import language from '../../language';

export default function() {

    const {
        syncTree
    } = this.props;
    let {
        humanResourceOrganizationValue,
        show_on_job_psn,
        currentSelectDepartment
    } = this.state;

    let postData = {
        pk_org: humanResourceOrganizationValue.refpk,
        showHisGrp: show_on_job_psn
    };

    requestTreeData(postData)
        .then((res) => {
            syncTree.setSyncTreeData('keyPsnGroupTree', [{
                code: 'root',
                id: 'root',
                key: 'root',
                name: language['hi6007-000213'], // '关键人员组',
                refname: language['hi6007-000213'], //'关键人员组',
                refpk: 'root',
                children: res.data
            }]);
            if(res.data && res.data.length > 0) {
                syncTree.openNodeByPk('keyPsnGroupTree', 'root');
                syncTree.setNodeSelected('keyPsnGroupTree', currentSelectDepartment || 'root');
                this.doDisabledTreeNodeList();
            }
        });

}